﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using COFE.Core.Actions;
using COFE.Core;
using COFE.Data.Lister;
using COFE.Core.Lister;

namespace COFE.Data
{
    //public class WriteListingWork : WorkBase
    //{
    //    #region Constructor

    //    public WriteListingWork(Guid workId, IPropertyProvider[] pendingToWrite)
    //        : base(workId)
    //    {
    //        _pendingToWrite = pendingToWrite;
    //    }


    //    /// <summary>
    //    /// Schedule a CachePropertiesWork in COFEAction.WorkScheduler.
    //    /// </summary>
    //    /// <param name="dirId">The directory entry must already exists in database.</param>        
    //    /// <returns>Schedule id</returns>
    //    public static Guid ScheduleWork(Guid dirId, int recursionLv = 0)
    //    {
    //        var work = new CacheListingWork(Guid.NewGuid(), dirId, recursionLv);
    //        return COFEActionShared.WorkScheduler.Enqueue(WorkPriority.Low, work);
    //    }

    //    #endregion

    //    #region Methods

    //    protected override void DoWork()
    //    {
    //        //Obtain cached version of directory entry.
    //        var dirEntry = COFEShared.CurrentUserProfile.TryParseGuid(_dirId) as IInternalDirectoryInfoExA;
    //        if (dirEntry != null)
    //        {
    //            foreach (var entry in dirEntry.DirectoryLister.List(dirEntry, 
    //                Core.Profile.EntryConstructionFlags.Default))
    //                if (_recursionLv > 0 && entry is IDirectoryInfo)
    //                    CacheListingWork.ScheduleWork(entry.GetId(), _recursionLv - 1);                        
    //        }
    //    }

    //    #endregion

    //    #region Data

    //    private IPropertyProvider[] _pendingToWrite;

    //    #endregion 

    //    #region Public Properties

    //    #endregion
    //}
}
